import {baseUrl} from '@/config/env';
import userApi from "@/api/sys/userApi";
import userOption from "@/option/sys/userOption";
import optionUtils from "@/option/optionUtils";

export default () => {
    return {
        index: true,
        submitText: '修改',
        size: 'small',
        labelWidth: 120,
        menuType: 'menu',
        menuAlign: 'center',
        menuPosition: "right",
        addBtn: false,
        delBtn: true,
        editBtn: false,
        column: [

            {
                label: '实例名称',
                prop: 'name',
                span: 12,
                rules: [{
                    required: true,
                    trigger: "blur"
                }]
            },
            {
                label: '发起人',
                span: 12,
                prop: 'startUserId',
                type: "table",
                onLoad: (onLoadParams, callback) =>{
                    onLoadParams.pageDefinition = userApi.list
                    onLoadParams.valueDefinition = userApi.getUserInfo
                    onLoadParams.option = userOption;
                    optionUtils.tableOnLoad(onLoadParams,callback)
                },
                formatter: (row) => {
                    if (!row) return;
                    if (row.nickName) {
                        return row.nickName;
                    } else if (row.realName) {
                        return row.realName
                    }
                    return row.userName;
                }
            },
            {
                label: '流程定义名称',
                prop: 'processDefinitionName',
                span: 12,
            },
            {
                label: '应用版本',
                prop: 'appVersion',
                span: 12,
            }, {
                label: '启动时间',
                prop: 'startTime',
                span: 12,
                type: 'datetime',
                valueFormat: 'yyyy-MM-dd HH:mm:ss',
                format: 'yyyy-MM-dd HH:mm:ss',
                editDisplay: false,
                addDisplay: false
            },
        ]
    }
}
